<template>
  <div class="wrap">
    <header>
      <h1>宏烨找房后台管理系统</h1>
    </header>
    <main>
      <div class="left">
        <select>
          <option>管理员</option>
          <option>员工</option>
          <option>经纪人</option>
        </select>
        <router-link v-for="(item,index) in list" :key="index" :to="item.path">{{item.title}}</router-link>
      </div>
      <div class="right">
        <router-view></router-view>
      </div>
    </main>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: [
        {
          title: "房源管理",
          path: "/house"
        },
        {
          title: "直播管理",
          path: "/zhibo"
        },
        {
          title: "团购管理",
          path: "/tuangou"
        },
        {
          title: "审核管理",
          path: "/shenhe"
        },
        {
          title: "订单管理",
          path: "/dingdan"
        },
        {
          title: "资讯管理",
          path: "/zixun"
        },
        // {
        //   title: "经纪人管理",
        //   path: "/person"
        // }
      ]
    };
  },
  created() {
    //登录成功  拿到token   不成功 返回login页面
    const token = localStorage.getItem("token");
    if (!token) {
      this.$router.push("/login");
    }
  },
  methods: {}
};
</script>

<style lang='scss' scoped>
.wrap {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}
header {
  width: 100%;
  height: 80px;
  line-height: 80px;
  background: blue;
  h1 {
    color: #fff;
    padding-left: 15px;
  }
}
main {
  width: 100%;
  height: 700px;
  display: flex;
  background: #f1f1f1;
  .left {
    padding: 15px;
    width: 15%;
    height: 700px;
    background: #333;
    display: flex;
    flex-direction: column;
    line-height: 70px;
    font-size: 20px;
    select {
      width: 80px;
      height: 30px;
      padding: 5px;
      text-align: center;
      background: #333;
      margin: 10px 0 50px 40px;
      font-size: 16px;
      padding: 2px;
      color: #999;
      option {
        border: none;
        background: #333;
      }
    }
    a {
      color: #999;
      padding-left: 10px;
    }
    .router-link-active {
      color: palevioletred;
    }
  }
  .right {
    width: 88%;
    height: 90%;
    padding: 10px;
    // border: 1px solid;
    width: 90%;
    .right1 {
      font-size: 16px;
    }
  }
}
</style>